import Vue from 'vue'
import VueRouter from 'vue-router'

const Login = () => import('../views/login')
const Home = () => import('../views/home')
const Layout = () => import('../layout')
const Dept = () => import('../views/department')
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    component: Login
  },
  // 登录页面后的页面
  {
    path: '/home',
    component: Layout,
    children: [
      {
        path: '/home',
        component: Home
      }
    ]

  },
  {
    path: '/department',
    component: Layout,
    children: [
      {
        path: '/department',
        component: Dept
      }
    ]
  }

]

const router = new VueRouter({
  routes
})

export default router
